package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * 向文件中写入文本数据
 */
public class WriteStringDemo {
    public static void main(String[] args) throws IOException {
        Scanner scanner=new Scanner(System.in);
        FileOutputStream fos=new FileOutputStream("fos.txt",true);
        String line=scanner.nextLine();
        byte[]data=line.getBytes();
        fos.write(data);
        fos.write("哎哟".getBytes());
        System.out.println("写出完毕");
        fos.close();
    }
}
